home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Programming / tek / visual / setinput.c < prev    next >
C/C++ Source or Header  |  2001-05-18  |  879b  |  41 lines

  1.  
  2. #include "tek/visual.h"
  3. #include "tek/debug.h"
  4. #include "tek/kn/visual.h"
  5.  
  6. /* 
  7. **    TEKlib
  8. **    (C) 2001 TEK neoscientists
  9. **    all rights reserved.
  10. **
  11. **    TUINT oldmask = TVSetInput(TAPTR visual, TUINT clearmask, TUINT setmask)
  12. **
  13. **    get and set mask of input events to be monitored.
  14. */
  15.  
  16. TUINT TVSetInput(TAPTR visual, TUINT clearmask, TUINT setmask)
  17. {
  18.     TVISUAL *v = (TVISUAL *) visual;
  19.     TDRAWMSG *msg;
  20.     TUINT ret;
  21.  
  22.     for (;;)
  23.     {
  24.         if ((msg = TGetMsg(v->asyncport)))
  25.         {
  26.             msg->jobcode = TVJOB_SETINPUT;
  27.             msg->op.input.clearmask = clearmask;
  28.             msg->op.input.setmask = setmask;
  29.  
  30.             TSendMsg(v->parenttask, TTaskPort(v->task), msg);            
  31.  
  32.             kn_lock(&v->asyncport->lock);
  33.             TAddTail(&v->asyncport->msglist, (TNODE *) (((TMSG *) msg) - 1));
  34.             ret = msg->op.input.oldmask;
  35.             kn_unlock(&v->asyncport->lock);
  36.             return ret;
  37.         }
  38.         TWaitPort(v->asyncport);        /* wait for free node */
  39.     }
  40. }
  41.